package cc.io24.knewcafe.boss.controller;

import cc.io24.knewcafe.boss.facade.model.Post;
import cc.io24.knewcafe.boss.service.PostService;
import com.netflix.zuul.context.RequestContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@RequestMapping("/Post")
public class PostController extends BaseController<Post> {

    @Autowired
    public void setService(PostService postService) {
        super.setService(postService);
    }

    @Override
    public List<Post> getList(Post post, Pageable pageable, HttpServletResponse response) {
        RequestContext.getCurrentContext().set("server", post.getServer());
        return super.getList(post, pageable, response);
    }
}
